//---------------------------------------------------------------------
// File: BizUnitTests.cs
// 
// Summary: 
//
// Author: Kevin B. Smith (http://blogs.msdn.com/kevinsmi)
//
//---------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
// KIND, WHETHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
// PURPOSE.
//---------------------------------------------------------------------

using System.IO;
using NUnit.Framework;


namespace Tests.BizUnitExtensions.BizTalk
{
	using Microsoft.Services.BizTalkApplicationFramework.BizUnit;
    
	/// <summary>
	/// The BizUnit Extensions Tests is a test library for some of the extensions.
	/// It is provided here as a indicative sample of what may be achieved but 
	/// actually unlike NUnit tests which test the assembly in question and can be 
	/// assisted by mock libraries, the BizUnit assemblies actually control real 
	/// orchestrations and other Biztalk artifacts which it is impossible to mock
	/// and provide. Therefore please use these only as a guide.
	/// 
	/// In the future versions of the test library we will try and provide a sample
	/// application which can be deployed for the tests to be run against and which
	/// will allow the tests to be completely repeatable and reusable. It may also be 
	/// more prudent to do this against the SDK samples since they are freely available 
	/// in any case
	/// 
	/// The method numbers are out of sequence in some places because we have refactored 
	/// the code base to move some steps into other libraries and created separate test 
	/// projects for them
	/// </summary>
	[TestFixture]
	public class BizUnitExtensionsBizTalkTests
	{
		/// <summary>
		/// The common setup for all tests. Runs the Test_Setup.xml file which copies the InDoc1.xml file
		/// from the source folder to the Rec_Setup folder. This is the same as the CoreTests
		/// </summary>
		[TestFixtureSetUp]
		public void SetUp()
		{
            
            //deploy the sdk sample here
            BizUnit bizUnit = new BizUnit(@".\..\..\TestCases\Test_Setup.xml", BizUnit.TestGroupPhase.TestGroupSetup);
            bizUnit.RunTest();
		}

		/// <summary>
		/// Common teardown step to delete the xml file from the Rec_Setup folder
		/// </summary>
		[TestFixtureTearDown]
		public void TearDown()
		{
            //undeploy the sdk sample here

			//Microsoft.Services.BizTalkApplicationFramework.BizUnit.
			//BizUnit bizUnit = new BizUnit(@".\..\..\TestCases\Test_TearDown.xml",BizUnit.TestGroupPhase.TestGroupTearDown);
			//bizUnit.RunTest();
		}

        /// <summary>
        /// This test checks the ApplicationConductor step
        /// </summary>
        [Test]
        public void Test_01_ApplicationConductor()
        {
            
            BizUnit bizUnit = new BizUnit(@".\..\..\TestCases\Test_01_ApplicationConductor.xml");
            bizUnit.RunTest();
        }

        /// <summary>
        /// This test checks the ApplicationStatus step
        /// </summary>
        [Test]
        public void Test_02_ApplicationStatus()
        {
            BizUnit bizUnit = new BizUnit(@".\..\..\TestCases\Test_02_ApplicationStatus.xml");
            bizUnit.RunTest();
        }

		/// <summary>
		/// This test disables and enables a receive location with a 5 second delay in between
		/// It requires that the SDK Sample for Messaging-CBR be deployed
		/// </summary>
		[Test]
		public void Test_03_ReceivePortConductorExStep()
		{
			BizUnit bizUnit = new BizUnit(@".\..\..\TestCases\Test_03_ReceivePortConductorEx.xml");
			bizUnit.RunTest();
		}

		/// <summary>
		/// This test stops and starts an existing orchestration.
		/// It requires that the SDK sample CONSUME WEB SERVICE be deployed
		/// </summary>
		[Test]
		public void Test_04_OrchestrationConductorExStep()
		{
			BizUnit bizUnit = new BizUnit(@".\..\..\TestCases\Test_04_OrchestrationConductorEx.xml");
			bizUnit.RunTest();
		}

        /// <summary>
        /// This test checks the SendPortConductor step
        /// </summary>
        [Test]
        public void Test_05_SendPortConductor()
        {
            BizUnit bizUnit = new BizUnit(@".\..\..\TestCases\Test_05_SendPortConductor.xml");
            bizUnit.RunTest();
        }

        /// <summary>
        /// This test checks the SendPortStarted step
        /// </summary>
        [Test]
        public void Test_06_SendPortStatus()
        {
            BizUnit bizUnit = new BizUnit(@".\..\..\TestCases\Test_06_SendPortStatus.xml");
            bizUnit.RunTest();
        }


        /// <summary>
        /// This test checks the MapExecutingStep step
        /// </summary> 
        [Test]
        public void Test_07_MapExecuting()
        {
            BizUnit bizUnit = new BizUnit(@".\..\..\TestCases\Test_07_MapExecuting.xml");
            bizUnit.RunTest();
        }
	
	
    }

}
